<?php
if(isset($_POST['SubmitCategory']))
{
	if(isset($_GET['edit']))
	$str="update banner_category set category='".$_POST['title']."',status='".$_POST['status']."' where id='".$_GET['edit']."'";
	else
	$str="insert into banner_category set category='".$_POST['title']."',status='".$_POST['status']."'";
	
	$exe=mysql_query($str);
	if($exe)
	echo "<script>window.location='index.php?tc=category&succ';</script>";
}
$edit=mysql_fetch_array(mysql_query("select * from banner_category where id='".$_GET['edit']."'"));
?>
	<form action="" method="post" enctype="multipart/form-data" name="form1">
	<div style="text-align:left; padding-left:10px; width:800px; padding-bottom:20px; float:left;"><strong>Home Page Banners</strong>
    <a href="index.php?tc=banners&add" class="font12" style="padding-left:350px;">Add New</a> | 
    <a href="index.php?tc=category" class="font12" style="padding-left:5px;">Category</a> |
    <a href="index.php?tc=category" class="font12" style="padding-left:5px;">Add Category</a>    
    </div>
    <div style="text-align:left; padding-left:10px; padding-top:30px; float:left; width:600px;">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="21%" align="right" valign="middle" class="font12">Category</td>
    <td width="9%" align="left" valign="middle">&nbsp;</td>
    <td width="41%" align="left" valign="middle">
      <input type="text" name="title" id="title" class="txtborder" value="<?php echo $edit['category'];?>" style="width:220px;" />
      </td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="font12">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="font12">Status</td>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">
      <select name="status" id="status" class="txtborder">
        <option <?php if($edit['status']=="1"){echo "selected";}?> value="1">Activate</option>
        <option <?php if($edit['status']=="0"){echo "selected";}?> value="0">Deactivate</option>
        </select>
      </td>
  </tr>
  <tr>
    <td align="right" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
  </tr>
  <tr>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">&nbsp;</td>
    <td align="left" valign="middle">
    <input type="submit" value="Save" name="SubmitCategory"/></td>
  </tr>
</table>
    <hr color="#999999" size="1" />
    </div>
</form>

